#ifndef MSGBOX_H
#define MSGBOX_H

//#include <raygui.h>
#include "rpak.h"

typedef struct MsgboxState
{
	Rectangle rec;
	char *title, *msg;
	void (*work)(unsigned int *, unsigned int *);
} MsgboxState;

#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus

bool GuiMsgbox(MsgboxState *state, unsigned int *count, unsigned int *selected)
{
	int r = GuiMessageBox(state->rec, TextFormat("#153#%s", state->title), state->msg, "Yes;No");
	if (IsKeyPressed(KEY_ENTER) || r == 1) // Enter || Yes
	{
		state->work(count, selected);

		return false;
	}
	else if (IsKeyPressed(KEY_ESCAPE) || r == 0 || r == 2) // Esc || X || No
		return false;
	else
		return true;
}

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // MSGBOX_H